/**
*****************************************************************************
 * @file pressuresensor.h
 * @brief 压力传感器设备函数(Keller)
 * @author luffy
 * @version V1.0.0
 * @date 2022/12/09
****************************************************************************
 */
#ifndef _DYNAMOMETER_H
#define _DYNAMOMETER_H

#include <stdint.h>
#include "modbus_RTU_mast.h"
/* Public defines -----------------------------------------------------------*/
#define PS_modbus_table_num  1         //压力传感器2组数据
#define P_sensor_num         4         //四路压力传感器(后期会增加)
#define P_sensorA_num        1         //485A接1路压力传感器
#define P_sensorB_num        2         //485B接2路压力传感器
/* Public Struct -----------------------------------------------------------*/
typedef struct
{
    float P_sensor1;       //传感器1压力值，单位Pa(1bar = 100000Pa)
	float T_sensor1;       //传感器1温度值，单位℃
    float P_sensor2;       //传感器2压力值，单位Pa
    float T_sensor2;       //传感器2温度值，单位℃
	uint8_t status;        //通信状态（1：成功， 0：失败）
} psensor_t;

/* Public enum -----------------------------------------------------------*/

/* Public Variable ---------------------------------------------------------*/
//Pointer
extern psensor_t pBody;
extern psensor_t pS1;
extern psensor_t pS2;
extern psensor_t pS3;
extern modbus_table_t PS_modbus_table[P_sensor_num][PS_modbus_table_num];
//Array
//Const
/* Pubilc function prototypes -----------------------------------------------*/
void pressuresensorA_init(void);
void pressuresensorA_handler(uint16_t timebase);
void pressuresensorB_init(void);
void pressuresensorB_handler(uint16_t timebase);

#endif
